close all student sessions while resetting their passwords
parent
68d1826405
commit
4e2b3f1408
|
@ -358,7 +358,8 @@ final class Clas(
|
|||
def studentResetPassword(id: String, username: String) = Secure(_.Teacher) { _ => me =>
|
||||
WithClass(me, id) { _ => clas =>
|
||||
WithStudent(clas, username) { s =>
|
||||
env.clas.api.student.resetPassword(s.student) map { password =>
|
||||
env.security.store.closeAllSessionsOf(s.user.id) >>
|
||||
env.clas.api.student.resetPassword(s.student) map { password =>
|
||||
Redirect(routes.Clas.studentShow(clas.id.value, username))
|
||||
.flashing("password" -> password.value)
|
||||
}
|
||||
|
|
|
@ -92,6 +92,15 @@ final class Store(val coll: Coll, localIp: IpAddress)(implicit ec: scala.concurr
|
|||
)
|
||||
.void
|
||||
|
||||
def closeAllSessionsOf(userId: User.ID): Funit =
|
||||
coll.update
|
||||
.one(
|
||||
$doc("user" -> userId, "up" -> true),
|
||||
$set("up" -> false),
|
||||
multi = true
|
||||
)
|
||||
.void
|
||||
|
||||
// useful when closing an account,
|
||||
// we want to logout too
|
||||
def disconnect(userId: User.ID): Funit =
|
||||
|
|
Loading…
Reference in New Issue