Skip to content

Commit

Permalink
Merge pull request #102 from pirog/80-password-prompt-no-timeout
Browse files Browse the repository at this point in the history
80 password prompt no timeout
  • Loading branch information
pirog committed Jul 29, 2014
2 parents f47a997 + 4217dc1 commit cdd8569
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
5 changes: 5 additions & 0 deletions kalabox/installer/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ var installDMG = flow('installDMG')(
* Route handler that installs Kalabox.
*/
var install = flow('installKalabox')(
// use -k here because if you've previous entered sudo and are under timeout
// it will do weird things and you could enter in a wrong password
function installResetPassword() {
exec('sudo -k', this.async());
},
// Get asking for the user's password out of the way.
function installGetPassword() {
sudoRunner.runCommand('echo', ['We needs the passwordz...'], this.async());
Expand Down
8 changes: 5 additions & 3 deletions kalabox/utils/task-runner/sudo-pass.scpt
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
set kalaicon to 2
tell application "System Events" to set itExists to ¬
exists of alias ((path to me as text) & ":app.icns")
exists of alias ((path to me as text) & ":..:..:..:..:app.icns")
if itExists
set kalaicon to alias ((path to me as text) & ":app.icns")
set kalaicon to alias ((path to me as text) & ":..:..:..:..:app.icns")
end if
with timeout of 86400 seconds
tell application "SystemUIServer"
activate
set my_password to display dialog ¬
"Please enter your Mac user account password. Installation will fail if your account does not have administrative privileges." with title ¬
"Password" with icon kalaicon ¬
default answer ¬
"" buttons {"Cancel", "OK"} default button 2 ¬
giving up after 295 ¬
giving up after 86400 ¬
with hidden answer
end tell
end timeout
24 changes: 19 additions & 5 deletions views/permission_denied.ejs
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
<div class="kalawrap">

<h1>You Don't Trust <em>US</em>?</h1>

<p>You didn't give us permission to download a Kalabox dependency. Unfortunately, this means no Kalabox for you. If you change your mind, re-run the installer and we'll welcome you back with open arms.</p>
<div class="start kalawrap">
<hr>
<div class="kalatron">
<h1>:( Try Again?</h1>
<p id="info" class="lead">Kalabox mixes VirtualBox and Vagrant into
its hot bubbling cauldron of Deep Dark Magic. However, Kalabox
wouldn't dare brew this stew without the express virtual consent
of you the user. Ergo, click below and let's make this baby go!*</p>
<a class="btn btn-large btn-success btn-massive" href="install">Box me</a>

</div>
<hr>
<p>
<small>* To be 100% explicit if you click the button you agree to
the download and installation of <a target="_blank"
href="https://www.virtualbox.org/">VirtualBox</a> and <a
target="_blank" href="http://www.vagrantup.com/">Vagrant</a><a
href="dash">.</a>
</small>
</p>
</div>

<script src="/js/errors.js"></script>

0 comments on commit cdd8569

Please sign in to comment.