35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
// Generated by CoffeeScript 1.12.6
|
|
(function() {
|
|
"use strict";
|
|
App.Managers = {
|
|
generatePassword: function() {
|
|
var chars, possible_chars;
|
|
possible_chars = "aAbcdeEfghiJkmnpqrstuUvwxyz23456789";
|
|
chars = Array.apply(null, {
|
|
length: 12
|
|
}).map(function() {
|
|
var i;
|
|
i = Math.floor(Math.random() * possible_chars.length);
|
|
return possible_chars.charAt(i);
|
|
});
|
|
return chars.join("");
|
|
},
|
|
togglePassword: function(type) {
|
|
return $("#user_password").prop("type", type);
|
|
},
|
|
initialize: function() {
|
|
$(".generate-random-value").on("click", function() {
|
|
return $("#user_password").val(App.Managers.generatePassword());
|
|
});
|
|
return $(".show-password").on("click", function() {
|
|
if ($("#user_password").is("input[type='password']")) {
|
|
return App.Managers.togglePassword("text");
|
|
} else {
|
|
return App.Managers.togglePassword("password");
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
}).call(this);
|