# Call an API to register a patron
sub register_patron {
- my ($self, $conn, $auth, $session_id, $password) = @_;
+ my ($self, $conn, $auth, $session_id, $email, $password) = @_;
$logger->info("EbookAPI: Initiating patron registration");
# verify that user is authenticated in EG
return;
}
+ # Update email in the Evergreen system if changed by the user
+ if (lc $editor->requestor->email ne lc $email) {
+ #Begin transaction
+ $editor->xact_begin;
+ my $db_user = $editor->retrieve_actor_user($editor->requestor->id);
+ $db_user->email($email);
+
+ $editor->update_actor_user($db_user) or return $editor->die_event;
+ $editor->commit;
+ }
+
$logger->info("EbookAPI: User Authenticated. Now, registering the patron with RBDigital");
my $handler = new_handler($session_id);
type => 'string'
},
{
+ name => 'email',
+ desc => 'New email address for evergreen and vendor portal',
+ type => 'string'
+ },
+ {
name => 'password',
desc => 'The password for vendor portal',
type => 'string'
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
- <h4><span class="glyphicon glyphicon-lock"></span>New RBDigital Password</h4>
+ <h4><span class="glyphicon glyphicon-lock"></span>Create RBdigital Password</h4>
</div>
<div class="modal-body">
<form id="frmRegisterRBDigital" role="form">
<div class="form-group">
<label for="usrname"><span class="glyphicon glyphicon-user"></span> Username</label>
- <input type="text" class="form-control" id="userrname" placeholder="Enter email" value="[% ctx.user.usrname | html; %]" disabled>
+ <input type="text" class="form-control" id="userrname" value="[% ctx.user.usrname | html; %]" disabled>
</div>
<div id="divPassword" class="form-group">
- <label for="psw"><span class="glyphicon glyphicon-eye-open"></span> New Password</label>
+ <label for="psw"><span class="glyphicon glyphicon-eye-open"></span> New RBdigital Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="Enter new password"
data-toggle="tooltip" data-placement="right" data-html="true" autofocus required>
</div>
data-toggle="tooltip" data-placement="right" title="Confirm password must match the password field." required>
</div>
<div id="confirmPasswordError" class="hidden alert alert-danger">Confirm password must match with the password you entered.</div>
+ <div class="form-group">
+ <label for="email"><span class="glyphicon glyphicon-envelope"></span> Email</label>
+ <input type="email" class="form-control" id="email" placeholder="Enter email" value="[% ctx.user.email | html; %]"
+ data-toggle="tooltip" data-placement="right" title="Note: Changing your email here will also update your account's email address." required>
+ </div>
<button id="btnRegister" type="submit" class="btn btn-success pull-left"><span class="glyphicon glyphicon-off"></span> Register</button>
<button id="btnCancel" type="submit" class="btn btn-danger btn-default pull-right" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Cancel</button>
}
//Register a patron
-Ebook.prototype.registerPatron = function(authtoken, password, callback) {
+Ebook.prototype.registerPatron = function(authtoken, email, password, callback) {
var ebook = this;
console.log(dojo.cookie(this.vendor));
//Reload new session (if any)
new OpenSRF.ClientSession('open-ils.ebook_api').request({
method: 'open-ils.ebook_api.patron.register',
- params: [authtoken, ses, password],
+ params: [authtoken, ses, email, password],
async: true,
oncomplete: function(r) {
var resp = r.recv();
var password = $('#password'),
confirmPassword = $('#confirmPassword'),
passwordError = $('#passwordError'),
- confirmPasswordError = $('#confirmPasswordError');
+ confirmPasswordError = $('#confirmPasswordError'),
+ email = $('#email').val();
passwordError.addClass('hidden');
confirmPasswordError.addClass('hidden');
$('#registerError').addClass('hidden');
- console.log(password.val());
//Check if password matches the strength
if (!checkPasswordStrength(password.val())) {
password.focus();
}
$('#btnRegister').prop("disabled", true);
$('#registerProgress').removeClass('hidden');
- ebook_rbdigital.registerPatron(authtoken, password.val(), registerPatronCallback);
+ ebook_rbdigital.registerPatron(authtoken, email, password.val(), registerPatronCallback);
});
$("#btnCloseRegisterSuccess").click(function(event) {
//redirect user to rbdigital search page
window.location.href = window.location.protocol+"//"+window.location.host+$("#lnkSearchResults_rbdigital").attr('href');
-
});
//Listen for Save Mapping Fields Event