window.MVC.Controllers.PageRegistration.prototype.signup = function (formData) {
if (!this.validateForm(formData)) {
Notifications.setHeadline('');
Notifications.setText(Labels.getLabel('Login_ValidateFailed'));
Notifications.show();
} else {
Preloader.show();
$passwordHash = CryptoJS.SHA256(formData.password);
$password = $passwordHash.toString(CryptoJS.enc.Hex);
var payload = { "username": formData.username,
"password": $password,
"email": formData.email,
"phone": formData.phone,
"fullname": formData.fullname,
"lat": formData.lat,
"lng": formData.lng,
"address": formData.address
};
window.Autobahn.call("pl.biokod.users", "signup", payload,
function(success, response) {
Preloader.hide();
if (success) {
Notifications.setHeadline('Rejestracja');
Notifications.setText("Zostałeś pomyślnie zarejestrowany.");
Notifications.show();
window.location.href = PageRoutes.getRoute('login');
} else {
Notifications.setHeadline('Błąd rejestracji');
Notifications.setText(response.message);
Notifications.show();
}
}
);
}
};
window.MVC.Views.Registration.prototype.render = function (argFormat) {
if (argFormat == 'html') {
this.htmlString = [];
this.htmlString.push('<section id="registration" class="panel colors_black_semitransp">');
this.htmlString.push(' <div class="header">');
this.htmlString.push(' <div class="image"><img></img></div>');
this.htmlString.push(' <div class="label"><h2>Rejestracja</h2></div>');
this.htmlString.push(' </div>');
this.htmlString.push(' <div class="form">');
this.htmlString.push(' <form id="form_registration" name="form_registration" action="" method="POST" enctype="multipart/form-data" autocomplete="off">');
this.htmlString.push(' <input type="text" class="login" name="username" placeholder="Nazwa użytkownika"><br/>');
this.htmlString.push(' <input type="text" class="firstname" name="fullname" placeholder="Imię i nazwisko"><br/>');
this.htmlString.push(' <input type="text" id="geocomplete" class="address" name="address" placeholder="Domyślna lokalizacja"><br/>');
this.htmlString.push(' <input type="hidden" class="lat" name="lat" placeholder="Szerokość geograficzna">');
this.htmlString.push(' <input type="hidden" class="lng" name="lng" placeholder="Długość geograficzna">');
this.htmlString.push(' <input type="text" class="phone" name="phone" placeholder="Numer telefonu"><br/>');
this.htmlString.push(' <input type="text" class="email" name="email" placeholder="Adres email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$"><br/>');
this.htmlString.push(' <input type="password" class="password" name="password" placeholder="Hasło" pattern=".{6,}"><br/>');
this.htmlString.push(' <input type="password" class="retype_password" name="retype_password" placeholder="Powtórz hasło" pattern=".{6,}"><br/>');
this.htmlString.push(' <input type="file" class="profile_photo" name="profile_photo"><br/>');
this.htmlString.push(' <input type="checkbox" class="personal_data_consent" name="personal_data_consent" value="0">' + Labels.getLabel('Registration_DataProcessingConsent') + '<br/>')
this.htmlString.push(' <input type="submit" class="submit" name="submit" value="' + Labels.getLabel('Registration_SubmitLabel') + '">');
this.htmlString.push(' </form>');
this.htmlString.push(' </div>');
this.htmlString.push(' <div class="actions">');
this.htmlString.push(' <div class="text">' + Labels.getLabel('Actions_HaveAccount') + '<a href="' + PageRoutes.getRoute('login') + '">' + Labels.getLabel('Actions_LoginNow') + '</a></div>');
this.htmlString.push(' <div class="text">' + Labels.getLabel('Actions_ForgotPassword') + '<a href="' + PageRoutes.getRoute('password_recovery') + '">' + Labels.getLabel('Actions_RecoverPassword') + '</a></div>');
this.htmlString.push(' </div>');
this.htmlString.push(' <div class="legal_info">' + Labels.getLabel('Registration_LegalInfo') + '</div>');
this.htmlString.push('</section>');
return this.htmlString.join(NEW_LINE).toString();
}
};
Do zdjęcia ma być
method: `add_profile_photo`