1"use strict";(globalThis["webpackChunkcanvas_lms"]=globalThis["webpackChunkcanvas_lms"]||[]).push([[5234],{33201:(e,r,t)=>{t.r(r) 2var o=t(6507) 3var n=t.n(o) 4var s=t(75869) 5var i=t.n(s) 6var a=t(87155) 7var l=t(82411) 8t(38798) 9t(38593) 10class c extends a.ZP.View{static initClass(){this.prototype.events={"change input[name=initial_action]":"changeAction","click #logout_link":"logOutAndRefresh"}}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{} 11this.options=e 12super.initialize(...arguments) 13this.enrollUrl=this.$el.attr("action") 14this.action=this.initialAction=this.$el.find("input[type=hidden][name=initial_action]").val() 15if(ENV.ACCOUNT.recaptcha_key){const e=this 16n()(window).on("load",(function(){"undefined"!==typeof grecaptcha&&(e.dataCaptchaId=grecaptcha.render(e.$el.find(".g-recaptcha")[0],{sitekey:ENV.ACCOUNT.recaptcha_key,callback:()=>{e.recaptchaPassed=true 17e.$el.find("#submit_button").prop("disabled",false)},"expired-callback":()=>{e.recaptchaPassed=false 18e.$el.find("#submit_button").prop("disabled",true)}}))})) 19"create"===this.action&&this.$el.find("#submit_button").prop("disabled",true)}return this.$el.formSubmit({beforeSubmit:e=>this.beforeSubmit(e),success:e=>this.success(e),errorFormatter:e=>this.errorFormatter(e),error:()=>this.clearCaptcha(),disableWhileLoading:"spin_on_success"})}changeAction(e){this.action=n()(e.target).val() 20ENV.ACCOUNT.recaptcha_key&&this.$el.find("#submit_button").prop("disabled","create"===this.action&&!this.recaptchaPassed) 21this.$el.find(".user_info").hide() 22this.$el.find(`#${this.action}_user_info`).show() 23return this.$el.find("#submit_button").css({visibility:"visible"})}beforeSubmit(e){if(!this.action)return false 24if(this.options.confirmEnrollmentUrl&&"enroll"===this.action){window.location=this.options.confirmEnrollmentUrl 25return false}this.normalizeData(e) 26return this.$el.attr("action",(()=>{switch(this.action){case"create":return"/users" 27case"log_in":return"/login/canvas" 28case"enroll":return this.enrollUrl}})())}success(e){if("enroll"===this.action){let e=window.location.search 29e=e?`${e}&`:"?" 30e+="enrolled=1" 31"create"===this.initialAction&&(e+="&just_created=1") 32return window.location.search=e}return this.enroll()}normalizeData(e){if("log_in"===this.action){e["pseudonym_session[unique_id]"]=null!=e["pseudonym[unique_id]"]?e["pseudonym[unique_id]"]:"" 33e["pseudonym_session[password]"]=null!=e["pseudonym[password]"]?e["pseudonym[password]"]:""}return e}clearCaptcha(){if(ENV.ACCOUNT.recaptcha_key){"undefined"!==typeof grecaptcha&&grecaptcha.reset(this.dataCaptchaId) 34this.$el.find("#submit_button").prop("disabled",true)}}errorFormatter(e){const r=(()=>{switch(this.action){case"create":return(0,l.Z)(e) 35case"log_in":return this.loginErrors(e) 36case"enroll":return this.enrollErrors(e)}})() 37return r}loginErrors(e){const r=e[e.length-1] 38return n().flashError({html:r},3e4)}enrollErrors(e){if("already_enrolled"===u(null!=e.user?e.user.errors.self_enrollment_code:void 0,(e=>e[0].type))){window.location.reload(true) 39return[]}this.action=this.initialAction 40this.logOut() 41return e}enroll(){this.action="enroll" 42return this.$el.submit()}logOut(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0] 43return n().ajaxJSON("/logout","DELETE",{},(()=>{e&&window.location.reload(true)}))}logOutAndRefresh(e){e.preventDefault() 44return this.logOut(true)}}c.initClass() 45function u(e,r){return"undefined"!==typeof e&&null!==e?r(e):void 0}i()((()=>{const e=n().extend({},null!=ENV.SELF_ENROLLMENT_OPTIONS?ENV.SELF_ENROLLMENT_OPTIONS:{},{el:"#enroll_form"}) 46new c(e)}))},82411:(e,r,t)=>{t.d(r,{Z:()=>u}) 47var o=t(28344) 48var n=t(23536) 49var s=t(61323) 50var i=t(87155) 51const a=(0,s.useScope)("observer_pairing_code") 52class l extends i.ZP.Model{}l.prototype.errorMap={code:{invalid:a.t("errors.invalid","Invalid pairing code")}} 53function c(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{} 54let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{} 55let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"" 56for(let n in e){const s=e[n] 57n=o?`${o}[${n}]`:n 58let i="object"===typeof s 59null!=s.length&&false===r.arrays&&(i=false) 60i?c(s,r,t,n):t[n]=s}return t}function u(e,r){null==r&&(r=ENV.PASSWORD_POLICY) 61return c({user:o.Z.prototype.normalizeErrors(e.user),pseudonym:n.Z.prototype.normalizeErrors(e.pseudonym,r),observee:n.Z.prototype.normalizeErrors(e.observee,r),pairing_code:l.prototype.normalizeErrors(e.pairing_code)},{arrays:false})}},23536:(e,r,t)=>{t.d(r,{Z:()=>l}) 62var o=t(64598) 63var n=t(61323) 64var s=t(87155)
65const i=(0,n.useScope)("pseudonym");(0,o.l)(a,s.ZP.Model) 66function a(){return a.__super__.constructor.apply(this,arguments)}a.prototype.errorMap=function(e){null==e&&(e={}) 67return{unique_id:{too_short:i.t("errors.required","Required"),too_long:i.t("errors.too_long","Can't exceed %{max} characters",{max:100}),invalid:i.t("errors.invalid","May only contain letters, numbers, or the following: %{characters}",{characters:". + - _ @ ="}),taken:i.t("errors.taken","Already in use"),bad_credentials:i.t("errors.bad_credentials","Invalid username or password"),not_email:i.t("errors.not_email","Not a valid email address")},sis_user_id:{too_long:i.t("errors.too_long","Can't exceed %{max} characters",{max:255}),taken:i.t("errors.sis_taken","The SIS ID is already in use")},password:{too_short:i.t("errors.too_short","Must be at least %{min} characters",{min:e.min_length}),sequence:i.t("errors.sequence","Can't incude a run of more than %{max} characters (e.g. abcdef)",{max:e.max_sequence}),common:i.t("errors.common",'Can\'t use common passwords (e.g. "password")'),repeated:i.t("errors.repeated","Can't have the same character more than %{max} times in a row",{max:e.max_repeats}),confirmation:i.t("errors.mismatch","Doesn't match"),too_long:i.t("errors.too_long","Can't exceed %{max} characters",{max:255})},password_confirmation:{confirmation:i.t("errors.mismatch","Doesn't match")}}} 68a.prototype.normalizeErrors=function(e,r){let t,o,n,s,i,l,c,u,d,h 69if(e){l=["unique_id","password"] 70for(o=0,s=l.length;o<s;o++){h=l[o] 71if(!((null!=(c=e[h])?c.length:void 0)>1))continue 72d=null 73u=e[h] 74for(n=0,i=u.length;n<i;n++){t=u[n] 75"too_short"===t.type&&(d=t)}d&&(e[h]=[d])}}return a.__super__.normalizeErrors.call(this,e,r)} 76const l=a},28344:(e,r,t)=>{t.d(r,{Z:()=>c}) 77var o=t(64598) 78var n=t(61323) 79var s=t(25683) 80var i=t.n(s) 81var a=t(87155) 82const l=(0,n.useScope)("user") 83const c=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}(0,o.l)(r,e) 84r.prototype.modelType="user" 85r.prototype.resourceName="users" 86r.prototype.errorMap={name:{blank:l.t("errors.required","Required"),too_long:l.t("errors.too_long","Can't exceed %{max} characters",{max:255})},self_enrollment_code:{blank:l.t("errors.required","Required"),invalid:l.t("errors.invalid_code","Invalid code"),already_enrolled:l.t("errors.already_enrolled","You are already enrolled in this course"),concluded:l.t("This course has concluded"),full:l.t("errors.course_full","This course is full")},terms_of_use:{accepted:l.t("errors.terms","You must agree to the terms")}} 87r.prototype.enrollments=function(e,r){return i().where(this.get("enrollments"),e,r)} 88r.prototype.hasEnrollmentType=function(e){return!!this.enrollments({type:e},true)} 89r.prototype.hasEnrollmentRole=function(e){return!!this.enrollments({role:e},true)} 90r.prototype.findEnrollmentByRole=function(e){return this.enrollments({role:e},true)} 91r.prototype.allEnrollmentsByType=function(e){return this.enrollments({type:e})} 92r.prototype.allEnrollmentsByRole=function(e){return this.enrollments({role:e})} 93r.prototype.pending=function(e){return i().some(this.get("enrollments"),(function(r){let t 94return r.role===e&&("creation_pending"===(t=r.enrollment_state)||"invited"===t)}))} 95r.prototype.inactive=function(){return i().every(this.get("enrollments"),(function(e){return"inactive"===e.enrollment_state}))} 96r.prototype.sectionEditableEnrollments=function(){return i().select(this.get("enrollments"),(function(e){return"ObserverEnrollment"!==e.type}))} 97return r}(a.ZP.Model)}}]) 98 99//# sourceMappingURL=self_enrollment-c-4a887c9f53.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.