...
This commit is contained in:
28
Presentation/HushianWebApp/Service/CaptchaService.cs
Normal file
28
Presentation/HushianWebApp/Service/CaptchaService.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace HushianWebApp.Service
|
||||
{
|
||||
public static class CaptchaService
|
||||
{
|
||||
public static string GetCaptchaWord(int length)
|
||||
{
|
||||
var random = new Random(DateTime.Now.Millisecond);
|
||||
|
||||
// const string chars = "ABCDEFGHJKLMNPQRSTUWYZabcdefghijkmnpqrstuwz23456789*#!$%=";
|
||||
const string chars = "ABCDEFGHJKLMNPQRSTUWYZabcdefghijkmnpqrstuwz23456789";
|
||||
string cw = new(Enumerable.Repeat(chars, length)
|
||||
.Select(s => s[random.Next(s.Length)])
|
||||
.ToArray());
|
||||
|
||||
return cw;
|
||||
}
|
||||
public static string GenerateCaptchaBase64(string text, int width = 120, int height = 40)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user