<commit_before>package com.scalableminds.brainflight
package snippet

import config.Sitemap
import model._

import scala.xml._

import net.liftweb._
import common._
import http.{LiftScreen, S}
import util.FieldError
import util.Helpers._

/*
 * Use for editing the currently logged in user only.
 */
sealed trait BaseCurrentUserScreen extends BaseScreen {
  object userVar extends ScreenVar[User](User.currentUser.open_!)

  override def localSetup {
    Referer(Sitemap.account.url)
  }
}

object AccountScreen extends BaseCurrentUserScreen {
  addFields(() => userVar.is.accountScreenFields)

  def finish() {
    userVar.is.save
    S.notice("Account settings saved")
  }
}

sealed trait BasePasswordScreen {
  this: LiftScreen =>

  def pwdName: String = "Password"
  def pwdMinLength: Int = 6
  def pwdMaxLength: Int = 32

  val passwordField = password(pwdName, "", trim,
    valMinLen(pwdMinLength, "Password must be at least "+pwdMinLength+" characters"),
    valMaxLen(pwdMaxLength, "Password must be "+pwdMaxLength+" characters or less")
  )
  val confirmPasswordField = password("<PASSWORD>", "", trim)

  def passwordsMustMatch(): Errors = {
    if (passwordField.is != confirmPasswordField.is)
      List(FieldError(confirmPasswordField, "Passwords must match"))
    else Nil
  }
}


object PasswordScreen extends BaseCurrentUserScreen with BasePasswordScreen {
  override def pwdName = "<PASSWORD>"
  override def validations = passwordsMustMatch _ :: super.validations

  def finish() {<commit_msg>fixed tab index of registration form fields<commit_after>package com.scalableminds.brainflight
package snippet

import config.Sitemap
import model._

import scala.xml._

import net.liftweb._
import common._
import http.{LiftScreen, S}
import util.FieldError
import util.Helpers._

/*
 * Use for editing the currently logged in user only.
 */
sealed trait BaseCurrentUserScreen extends BaseScreen {
  object userVar extends ScreenVar[User](User.currentUser.open_!)

  override def localSetup {
    Referer(Sitemap.account.url)
  }
}

object AccountScreen extends BaseCurrentUserScreen {
  addFields(() => userVar.is.accountScreenFields)

  def finish() {
    userVar.is.save
    S.notice("Account settings saved")
  }
}

sealed trait BasePasswordScreen {
  this: LiftScreen =>

  def pwdName: String = "Password"
  def pwdMinLength: Int = 6
  def pwdMaxLength: Int = 32

  val passwordField = password(pwdName, "", trim,
    valMinLen(pwdMinLength, "Password must be at least "+pwdMinLength+" characters"),
    valMaxLen(pwdMaxLength, "Password must be "+pwdMaxLength+" characters or less"),
    ("tabindex" -> "1")
  )
  val confirmPasswordField = password("<PASSWORD>", "", trim,
    ("tabindex" -> "1")
  )

  def passwordsMustMatch(): Errors = {
    if (passwordField.is != confirmPasswordField.is)
      List(FieldError(confirmPasswordField, "Passwords must match"))
    else Nil
  }
}


object PasswordScreen extends BaseCurrentUserScreen with BasePasswordScreen {
  override def pwdName = "<PASSWORD>"
  override def validations = passwordsMustMatch _ :: super.validations

  def finish() {
{'fraction_non_alphanumeric': 0.09842393052428433, 'fraction_numerical': 0.002573174654229656, 'mean_word_length': 4.475352112676056, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '17748', 'n_tokens_mistral': 944, 'n_tokens_neox': 911, 'n_words': 260}